package com.auz.datagenerator.guiconnector;

import java.awt.FlowLayout;

import javax.swing.JCheckBox;
import javax.swing.JFrame;

import com.auz.datagenerator.publishing.tcpip.client.ClientPanel;

/**
 * Panel used to show a tick box allowing the user to choose whether or not to 
 * display a server-side preview of the data generated on a JFreeChart graph
 * @author Aurelien Bonnel
 */
public class PreviewOptionPanel extends AbstractPreviewOptionPanel {

	private static final long serialVersionUID = 8741057580005307587L;
	private ClientPanel previewPanel;

	/**
	 * Constructor
	 */
	public PreviewOptionPanel() {
		controlledFrame = new JFrame();
		controlledFrame.setSize(700, 480);
		previewPanel = new ClientPanel();
		controlledFrame.add(previewPanel);
		previewPanel.run();
		controlledFrame.setVisible(true);
		
		setLayout(new FlowLayout());
		// JLabel label  = new JLabel("Preview: ");
		option = new JCheckBox("Preview", true);
		option.addActionListener(this);
		
		// add(label);
		add(option);
	}
	
	/**
	 * Adds a value to the graph
	 * @param _value - the value to add
	 */
	/*public void addValue(double _value) {
		previewPanel.addValue(_value);
	}*/
	
	/**
	 * Adds a value to the graph
	 * @param _value - the value to add
	 */
	public void addValue(Object _value) {
		previewPanel.addValue((Double) _value);
	}
	
}
